package com.d0325;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;


public class TestSimpleDateFormat {
    public static void main(String[] args) {
        SimpleDateFormat sdf1=new SimpleDateFormat("yyyy年MM月dd日");
        SimpleDateFormat sdf2=new SimpleDateFormat("yyyy年MM月dd日hh;mm:ss");
        Date date = new Date();
        //System.out.println(sdf1.format(date));
        //System.out.println(sdf2.format(date));
        System.out.println(date);

        Calendar calendar1=Calendar.getInstance();
        calendar1.set(2020,Calendar.MARCH,31,10,23,45);
        System.out.println(sdf1.format(calendar1.getTime()));
        System.out.println(sdf2.format(calendar1.getTime()));


        //String-》Date
        /*String str="1999年6月14日";
        String str1="1999年6月14日03; 14:20";
        try {
            Date birth=sdf1.parse(str);
            Date birth2=sdf2.parse(str1);
            System.out.println(birth);
            System.out.println(birth2);
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }*/
    }
}
